<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>忘记密码</title>
<!-- 2-1.导入css -->
<link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
</head>
<body>
	<div id="headerpage" style="width:100%;height:154px;">
	<!--这个div是为了引入header.html头部-->
    </div>
    <h2 align="center">忘记密码</h2>
    <hr style="height:2px;border:none;background:#003399;"/> 
   <form class="layui-form layui-form-pane" id="forgetPwd_form" action="">
   <div style="width:320px;height:300px;margin:0 auto;margin-top:35px;">
	     <div class="layui-form-item">
		    <label class="layui-form-label">邮箱账号</label>
		    <div class="layui-input-inline">
		      <input type="text" id="useemail" name="useemail" autocomplete="off" lay-verify="email" placeholder="请输入邮箱账号" class="layui-input">
		  </div>
	  	  </div>
	  	  <div class="layui-form-item">
		    <label class="layui-form-label">用户姓名</label>
		    <div class="layui-input-inline">
		      <input type="text" id="usename" name="usename" autocomplete="off" lay-verify="required" placeholder="请输入用户姓名" class="layui-input">
		    </div>
	  	  </div>
	  	  <div class="layui-form-item">
		    <label class="layui-form-label">身份证号</label>
		    <div class="layui-input-inline">
		      <input type="text" id="useidnumber" name="useidnumber" autocomplete="off" lay-verify="required" placeholder="请输入身份证号" class="layui-input">
		    </div>
	  	  </div>
	  	  <div class="layui-form-item">
		    <label class="layui-form-label">重置密码</label>
		    <div class="layui-input-inline">
		      <input type="password" id="usepassword" name="usepassword" autocomplete="off" lay-verify="required" placeholder="请输入重置密码" class="layui-input">
		    </div>
	  	  </div>
	  	   <div class="layui-form-item">
		    <div class="layui-input-block" style="margin:0 auto;text-align:center">
		      <button class="layui-btn layui-btn-fluid" onclick="return false" style="width:140px;" lay-submit="" lay-filter="LAY-user-reg-reset">重置</button>
		    </div>
  		</div> 
  	  </div>
  	  </form>
  	  <iframe id="footerWrap"  width="100%" height="40px"  scrolling="no" frameborder="0"  src="/footer" noresize="noresize" style="position:absolute;top:90%;"/></iframe>
</body>
<!-- 2-2.导入js -->

<script src="../layuiadmin/layui/layui.js"></script>  
<script>
  
  layui.config({
    base: '../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form','table', 'laydate'], function(){
    var table = layui.table
    ,form = layui.form
    ,$ = layui.$
    ,admin = layui.admin;
    $("#headerpage").load("/header");
    form.on('submit(LAY-user-reg-reset)', function(data){
       var formData = new FormData(document.getElementById("forgetPwd_form"));
     $.ajax({
	      url: '/user/resetPasswd',
	      type: 'POST',
	  	  data:formData,
	  	  processData:false,
      	  contentType:false,
	      success: function (data) {
		  if(data==1){
              layer.msg('重置密码成功', {
                  offset: '15px'
                  ,icon: 6
                  ,time: 1000
              }, function(){
                  location.href = '/user/login'; //跳转到登入页
              });
			}else if(data==0){
              layer.msg('您输入的用户账号有误！',{
                  offset: '15px'
                  ,icon: 2
                  ,time: 1000
              });
			}else if(data==2){
				layer.msg('您输入的用户姓名有误！',{
                  offset: '15px'
                  ,icon: 2
                  ,time: 1000
              });
			}else if(data==3){
				layer.msg('您输入的身份证号有误！',{
	                  offset: '15px'
	                  ,icon: 2
	                  ,time: 1000
	              });
			}else{
				 layer.msg('重置密码时发生异常',{
	                    offset: '15px'
	                    ,icon: 5
	                    ,time: 1000
	                }); 
				}
		
	       }
}) 
    })
  });
  </script>
</html>